Skip to content

Fix package links in PR and MR security comments - #465

Merged
lelia merged 11 commits into
mainfrom
fix/comment-package-links
Nov 24, 2026
Merged

lelia merged 11 commits into
mainfrom
fix/comment-package-links

Conversation

@dc-larsen

@dc-larsen David Larsen (dc-larsen) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

“This package” opens the affected package version on socket.dev in GitHub and GitLab security comments. Security rows show one package link, and license findings for packages in different scopes or namespaces appear in separate rows.

Under --strict-blocking --disable-blocking, the existing-alerts header and the console summary now say those alerts don't fail the run. Both used to claim they did, although the exit code stays 0.

Verification

  • 1,051 unit and core tests passed. Coverage includes eight ecosystem and namespace combinations, scoped ignore commands in both tables, truncation order, and a hidden blocker that still fails under --strict-blocking.
  • Ruff, the locked dependency check, wheel and sdist builds, and Twine passed.
  • The original GitHub test-org run rendered 38 absolute package links, including three existing findings, and still exited 1 under --strict-blocking.

Release

Ships in 2.14.0. Merge order: #461 → #462 → #460 → #464 → #465 → #463. Merged together in that order on main at #459, the six pass the full test suite and ruff check. main requires branches to be up to date, so update each PR from main after the previous merge. CHANGELOG.md will conflict each time: combine the bullets under the existing ## 2.14.0 subsections (Upgrade notes, Changed, Fixed, Documentation) by hand rather than taking either side.

This is 5 of 6, after #464; both touch scm_comments.py and merge cleanly. This PR does not change the alert-type links ("What is known malware?" on every row, and the 404 at /alerts/license). That is CE-519, fixed by #406, which will need rebasing onto this PR's messages.py changes.

Review focus

  • The new and existing alert tables share row grouping and rendering helpers in messages.py.
  • Generated @SocketSecurity ignore commands include the package scope or namespace when present, for example npm/@team/widget@1.0.0. Existing bare-name commands still work.
  • Both tables share a comment size budget, with new rows taking space first. Each table keeps whole rows in order and reports how many findings it omitted. The comment links to the full report when available. Blocking decisions still consider all applicable findings.

Public changelog

“This package” links open the affected package version in GitHub and GitLab security comments. Scoped ignore commands target the package shown in the row. Large comments link to the full report and show how many findings were omitted. With --disable-blocking, existing alerts are no longer described as failing the run.


Fixes: CE-518
Refs: CE-519

Each security comment row linked "This package" to the bare package
coordinate (alert.purl, e.g. handlebars@4.0.11), so GitHub and GitLab
resolved it as a relative link to a page that does not exist. The alert
rows have done this since the HTML comment template was introduced, and
license rows since they were added; the --strict-blocking existing-alerts
table reuses both templates.

Both rows now use alert.url, the package overview URL that
Package.socket_url builds with the namespace (npm scope, Maven groupId, Go
module path). The Markdown, Slack and Jira outputs already link the package
with that URL.
…inks

# Conflicts:
#	CHANGELOG.md
#	socketsecurity/core/messages.py
2.13.2 was released from main, so this change needs the next patch version.
@lelia
lelia marked this pull request as ready for review November 24, 2026 02:53
@lelia
lelia requested a review from a team as a code owner November 24, 2026 02:53
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes PR/MR comment HTML, ignore matching, and truncation behavior used in CI; strict-blocking and policy outcomes intentionally remain based on full findings, not visible rows.

Overview
Releases 2.14.0 with socketdev 3.6.4 and rework how GitHub/GitLab security comments render packages and stay under size limits.

This package now links to the affected version on socket.dev (alert.url) instead of the PURL. Rows and generated @SocketSecurity ignore commands use package_name_with_namespace() so scoped/npm namespaces get distinct license rows and correctly qualified markers; ignore handling (matches_issue, matches_alert_marker) still accepts legacy bare package names.

Comment assembly reserves headers, footers, and omission notices up front, then fills new and existing alert tables from a shared UTF-8 byte budget (~60k). Omitted new and existing counts are reported separately, blocking existing alerts stay first when truncated, and policy/exit codes still consider all findings even when rows are dropped from the comment.

Reviewed by Cursor Bugbot for commit 5086da4. Configure here.

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:53 — with GitHub Actions Inactive
Include the package namespace in comment rows and generated ignore commands.
Match qualified commands in both scan results and comment updates, while
continuing to honor existing bare-name commands.
@lelia lelia changed the title Link "This package" in PR/MR comments to the package page Fix package links in PR and MR security comments Nov 24, 2026
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:58 — with GitHub Actions Inactive

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread socketsecurity/core/messages.py Resolved
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 03:05 — with GitHub Actions Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5086da4. Configure here.

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 03:27 — with GitHub Actions Inactive
# Conflicts:
#	CHANGELOG.md
@lelia
lelia merged commit b3dc63f into main Nov 24, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants